package com.ziroom.crm.rock.spring.config;

import com.ziroom.crm.mq.core.config.MqConfig;
import com.ziroom.crm.mq.core.resend.ReSendInitFunc;
import com.ziroom.crm.mq.core.resend.ReSendInvoker;
import lombok.Data;

@Data
@SuppressWarnings("ALL")
public class MqResendConfig {

    /**
     * 重试发送定时轮训参数 内存定时生效
     *
     * @see ReSendInitFunc#DEFAULT_SLEEP_TIME
     */
    private String sleepMilli;

    /**
     * 重试发送定时轮训每次查询得数据
     *
     * @see ReSendInvoker#DEFAULT_SIZE
     */
    private String fetchSize;

    /**
     * 阈值
     */
    private String threshold;


    public void initMqConfigResend() {
        MqConfig.setConfigOrDefault(MqConfig.RESEND_THREAD_SLEEP_MILLI, this.sleepMilli);
        MqConfig.setConfigOrDefault(MqConfig.RESEND_FETCH_SIZE, this.fetchSize);
        MqConfig.setConfigOrDefault(MqConfig.RESEND_THRESHOLD, this.threshold);
    }

}
